package com.jweb.framework.core.impl;

import com.jweb.framework.core.Context;
import com.jweb.framework.core.CoreException;
import com.jweb.framework.core.CoreRuntimeException;
import com.jweb.framework.core.ProcessExecutor;
import com.jweb.framework.core.support.TRACER;
import com.jweb.framework.core.support.Utils;


public class SimpleProcessExecutor extends AbstractProcessExecutor implements ProcessExecutor {

	public void execute(Context context) throws CoreException,
			CoreRuntimeException {
		
		TRACER.trace("starting action template '{}'" , new String[]{getName()});
		try {
			Utils.execute(context , getJservices() , getTransactional());
		} finally {
			if(context.getException() != null){
				TRACER.trace("finished jservices template '{}' with exception {}" , new Object[]{getName() , context.getException()});
			}
			else {
				TRACER.trace("finished jservices template '{}'" , new Object[]{getName()});
			}
		}
	}
}
